﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Life.cs" company="">
//   
// </copyright>
// <summary>
// An object that contains some life for the player.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

/*
 * Author: Barbara Carboni
 * Created: 17-11-2011 
 */

namespace ITU_vs_Zombies.Stuff
{
    using System;
    using System.Diagnostics.Contracts;

    using Microsoft.Xna.Framework;

    /// <summary>
    /// An object that contains some life for the player.
    /// </summary>
    [Serializable]
    public class Life : ExtraObject
    {
        #region Constants and Fields

        /// <summary>
        /// The value.
        /// </summary>
        private uint value;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Life"/> class.
        /// </summary>
        /// <param name="image">
        /// The Image. 
        /// </param>
        /// <param name="numberFrames">
        /// The number of frames. 
        /// </param>
        /// <param name="numberFloor">
        /// The number of floor. 
        /// </param>
        /// <param name="position">
        /// The position. 
        /// </param>
        /// <param name="value">
        /// The value. 
        /// </param>
        /// <param name="sound">
        /// The sound. 
        /// </param>
        public Life(string image, uint numberFrames, int numberFloor, Vector2 position, uint value, string sound)
            : base(image, numberFrames, numberFloor, position, sound)
        {
            Contract.Requires(image != null);
            Contract.Requires(sound != null);
            Contract.Requires(value > 0);
            Contract.Requires(numberFrames > 0);
            Contract.Requires(position.X >= 0 && position.Y >= 0);
            this.Value = value;
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets Value.
        /// </summary>
        public uint Value
        {
            get
            {
                Contract.Ensures(Contract.Result<uint>() > 0);
                return this.value;
            }

            private set
            {
                Contract.Requires(value > 0);
                this.value = value;
            }
        }

        #endregion
    }
}